#include <stdio.h>
int main()
{
    int c[5];
    while(scanf("%d",&c[1])!=EOF)
    {
       for(int i=2;i<=4;i++)
       scanf("%d",&c[i]);
       
       for(int i=1;i<=4;i++)
       if(c[i]==2||c[i]==3||c[i]==5||c[i]==6||c[i]==7||c[i]==8||c[i]==9||c[i]==0)
       printf(" _ ");
       else if(c[i]==1||c[i]==4)
       printf("   ");
       printf("\n");
       
       for(int i=1;i<=4;i++)
       if(c[i]==1||c[i]==7)
       printf("  |");
       else if(c[i]==2||c[i]==3)
       printf(" _|");
       else if(c[i]==4||c[i]==8||c[i]==9)
       printf("|_|");
       else if(c[i]==5||c[i]==6)
       printf("|_ ");
       else if(c[i]==0)
       printf("| |");
       printf("\n");
       
       for(int i=1;i<=4;i++)
       if(c[i]==1||c[i]==4||c[i]==7)
       printf("  |");
       else if(c[i]==2)
       printf("|_ ");
       else if(c[i]==3||c[i]==5||c[i]==9)
       printf(" _|");
       else if(c[i]==6||c[i]==8||c[i]==0)
       printf("|_|");
       printf("\n");
    }
    
    return 0;
}